#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;

int n, m;
struct Node {
  int x, v;
  bool operator<(const Node& o) const { return x < o.x; }
} a[N];
__int128_t b[N];
bool check(__int128_t t) {
  rep(i, 1, n) b[i] = 1000000000ll * a[i].x - a[i].v * t;
  __int128_t mx = -1e27;
  rep(i, 1, n) {
    if (a[i].v > 0) {
      if (b[i] <= mx) return true;
    } else {
      mx = max(mx, b[i]);
    }
  }
  return false;
}
void solve() {
  cin >> n;
  rep(i, 1, n) cin >> a[i].x >> a[i].v;
  rep(i, 1, n) a[i].v *= -1;
  sort(a + 1, a + n + 1);
  bool right = false;
  bool fail = true;
  rep(i, 1, n) {
    if (a[i].v < 0)
      right = true;
    else {
      if (right) {
        fail = false;
        break;
      }
    }
  }
  if (fail) {
    cout << -1;
    return;
  }
  ll l = 0, r = 1e18;
  while (l <= r) {
    ll mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  cout << fixed << setprecision(20) << (l / 1e9);
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}